<?php

require_once 'phpmoko/externals/JQueryUI.php';
require_once 'phpmoko/ui/RootPanel.php';
require_once 'phpmoko/ui/Form/FormBase.php';

class DateBox extends FormBase
{
	function __construct()
	{
		parent::__construct();

		$this->id = RootPanel::getUniqueId();

		JQueryUI::activate();
	}
	
	function toString()
	{
		$str = '<input';

		if ($this->id != null)
			$str .= ' id="'.$this->id.'"';

		if ($this->name != null)
			$str .= ' name="'.$this->name.'"';

		$str .= ' type="text">';
		
		$root = RootPanel::get();
		$root->addJSOnReadyDocument('$("#'.$this->id.'").datepicker();');
		
		return $str;
	}
}
?>